﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Ext.Net;

namespace DemoExtNet.Validation
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void CheckField(object sender, RemoteValidationEventArgs e)
        {
            TextField field = (TextField)sender;

            if (field.Text == "Valid")
            {
                e.Success = true;
            }
            else
            {
                e.Success = false;
                e.ErrorMessage = "'Valid' is valid value only";
            }

            System.Threading.Thread.Sleep(1000);
        }

        protected void CheckCombo(object sender, RemoteValidationEventArgs e)
        {
            ComboBox combo = (ComboBox)sender;

            if (combo.SelectedItem.Value == "2")
            {
                e.Success = true;
            }
            else
            {
                e.Success = false;
                e.ErrorMessage = "'Valid' is valid value only";
            }

            System.Threading.Thread.Sleep(1000);
        }
    }
}
